<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<fieldset>
	<legend>
		<strong>Agent Information</strong>
	</legend>
	<div id="content_main">
		<form:form method="post" action="/ChitFund/user/saveAgent.htm">
			<table>
				<tr>
					<td><form:label path="agentCode">Agent Code</form:label></td>
					<td><form:input path="agentCode" value="${agent.agentCode}"></form:input></td>
				</tr>
				<tr>
					<td><form:label path="branch.branchId">Branch</form:label></td>
					<td><select name="branch.branchId">
							<option selected="selected" value="null">select Branch</option>
							<c:forEach var="branch" items="${branches}">
								<option value="${branch.branchId}">
									<c:out value="${branch.branchName}" />
								</option>
							</c:forEach>
					</select></td>
				</tr>
				<tr>
					<td><form:label path="agentName">Agent Name</form:label></td>
					<td><form:input path="agentName" value="${agent.agentName}" /></td>
				</tr>
				<tr>
					<td><form:label path="address">Address</form:label></td>
					<td><form:input path="address" value="${agent.address}" /></td>
				</tr>
				<tr>
					<td><form:label path="phoneNo">Phone No.</form:label></td>
					<td><form:input path="phoneNo" value="${agent.phoneNo}" /></td>
				</tr>
				<tr>
					<td><form:label path="mobileNo">Mobile No.</form:label></td>
					<td><form:input path="mobileNo" value="${agent.mobileNo}" /></td>
				</tr>

			</table>
			<div class="form-btn">
				<input type="submit" name="Save" id="Save" value="Save"
					class="btn btn-large" /> <input type="reset" name="Clear"
					id="Clear" value="Reset" class="btn btn-large" />

			</div>
		</form:form>
	</div>

	<div class="span11">

		<h3>Agents</h3>

		<c:if test="${!empty agentList}">
			<table id="tblData"
				class="table table-bordered table-striped table-hover">
				<thead>
					<tr>
						<th>AgentCode</th>
						<th>agentName</th>
						<th>address</th>
						<th>phoneNo</th>
						<th>mobileNo</th>
						<th>Action</th>
					</tr>
				</thead>
				<tbody>

					<c:forEach items="${agentList}" var="agent">
						<tr>
							<td>${agent.agentCode}</td>
							<td>${agent.agentName}</td>
							<td>${agent.address}</td>
							<td>${agent.phoneNo}</td>
							<td>${agent.mobileNo}</td>
							<td><a href="/ChitFund/deleteAgent.htm?id=${agent.agentId}">delete</a></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</c:if>

		<c:if test="${empty agentList }">
			<c:out value="No Agent">
			</c:out>
		</c:if>
	</div>
</fieldset>